﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admins_FAQmanage : System.Web.UI.Page
{  
   

    protected void Page_Load(object sender, EventArgs e)
    {
       // BBS f = new BBS();
       // GridView1.DataSource = f.GetAll();
       // GridView1.DataBind();
    }

    protected void LinkButton1_Click(object sender, EventArgs e)   //显示全部公告
    {
        BBS bbs = new BBS();
        GridView.DataSource = bbs.returnbbs();
        GridView.DataBind();
    }

    protected void LinkButton2_Click(object sender, EventArgs e)    //删除公告
    {
        BBS f = new BBS();
        for (int i = 0; i < GridView.Rows.Count; i++)
        {
            CheckBox cb = (CheckBox)GridView.Rows[i].FindControl("CheckBox1");
            if (cb.Checked)
            {
                int str;
                str = Convert.ToInt32(GridView.Rows[i].Cells[0].Text);  //获取此项ID

                f.DeleteBBS(str);    //删除对应项
            }
        }
        GridView.DataSource = f.returnbbs();
        GridView.DataBind();
    }

    /// 在单击 GridView 控件内某一行的 Edit 按钮（其 CommandName 属性设置为“Edit”的按钮）时发生，但在 GridView 控件进入编辑模式之前。此事件通常用于取消编辑操作。
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView.EditIndex = e.NewEditIndex;
        BBS orderlists = new BBS();
        GridView.DataSource = orderlists.returnbbs();
        GridView.DataBind();
    }


    protected void dsdatabind()
    {
       
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {

    }
   
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {

       
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
    {

    }
    protected void GridView_RowEditing(object sender, GridViewEditEventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {

    }
}